<template>
  <div>
    <el-button @click="loginout">注销</el-button>
  </div>
</template>

<script>
import { mapActions } from 'vuex'
export default {
  name: 'LoginOut',
  methods:{
    ...mapActions('user',['logout']),
    loginout(){
      this.$confirm("是否退出登录?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(async () =>{
        await this.logout()
          .then(() =>{
            this.$router.push({path: '/login'})
          })
      })
    }
  }
}
</script>

<style scoped>

</style>
